# coding=utf-8
# 代码文件：chapter6/ch6.3.1.py

# import matplotlib.pyplot as plt
# import pandas as pd

import xlwings as xw

app = xw.App(visible=True, add_book=False)

f = r'data\股票历史交易数据.xlsx'

wb = app.books.open(f)

sheet1 = wb.sheets.active

rng = sheet1.range('A:E')  # 选择A~E列

chartsheet = wb.sheets.add(name='图表工作表', after=sheet1)  # 添加图表工作表

chart = chartsheet.charts.add(0, 0)  # 创建Chart对象

chart.chart_type = '3d_line'  # 设置图表类型
# 是设置图表的宽和高
chart.width = 500  # 是指定图表的宽度
chart.height = 500  # 是指定图表的高度

chart.set_source_data(rng)  # 设置图表数据源
